package com.cat.myblog.web.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cat.myblog.article.service.ArticleService;

import com.cat.myblog.common.entity.Article;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/article")
public class ArticleController {


    private ArticleService articleService;

    public ArticleController(ArticleService articleService) {
        this.articleService = articleService;
    }

    /**
     * 获取文章信息
     * @return
     */
    @RequestMapping(method = RequestMethod.GET,value = "/info")
    public String articleInfo(){
        return articleService.articleInfo();

    }


    @RequestMapping(method = RequestMethod.GET,value = "/list")
    public String articleList(@RequestParam(value = "pageNo") Long pageNo,
                              @RequestParam(value = "pageSize") Long pageSize){
        Page<Article> page = new Page<>(pageNo,pageSize);
        return articleService.listArticle(page);

    }
}
